package cn.cena.user.controller;


import cn.cena.basic.util.AjaxResult;
import cn.cena.user.service.IVerifycodeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/verifycode")
public class VerifycodeController {

    @Autowired
    private IVerifycodeService verifycodeService;

    @PostMapping("/sendSmsCode")
    public AjaxResult sendSmsCode(@RequestBody Map<String,String> params){

        try {
            verifycodeService.sendSmsCode(params);
            return AjaxResult.result();
        } catch (Exception e) {
            e.printStackTrace();
            return AjaxResult.result().setMsg("系统繁忙");
        }
    }

}
